<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1{
            background-image: url(./雪碧图.png);
            margin: 0 auto;
            width: 80px;
            height: 66px;
            /* 设置动画的执行时间 */
            animation-duration: 500ms;
            /* 设置动画的名字 */
            animation-name: test;
            /* 设置动画的执行次数 */
            animation-iteration-count: infinite;
            /* 设置动画执行的步骤 */
            animation-timing-function: steps(8);
            /* 设置动画的执行方向 */
            animation-direction: alternate;
        }
        @keyframes test{
            form{
                background-position: 0 0;
            }
            to{
                background-position: -640px 0;
            }
        }
    </style>
</head>
<body>
    <div class="box1"></div>
</body>
</html>